import request from '@/utils/request'
import variable from '@/utils/variables'
const baseURL = variable.URL.baseURL

// 商品详情
export function productDetails(params) {
  return request({
    baseURL: baseURL,
    url: '/product/select_product_details',
    method: 'GET',
    params: {
      productId: params
    }
  })
}

//商品评价列表
export function evaluationList(params) {
  return request({
    baseURL: baseURL,
    url: '/evaluation/search/products',
    method: 'GET',
    params:  params
  })
}

//商品列表
export function storeProductList(params) {
  return request({
    baseURL: baseURL,
    url: '/product/front/product_list',
    method: 'GET',
    params: params
  })
}

//自定义分类
export function storeFrontClassifyList(params) {
  return request({
    baseURL: baseURL,
    url: '/product/front/classify/custom_list',
    method: 'GET',
    params: params
  })
}

//热销商品排行
export function productPromotionList(params) {
  return request({
    baseURL: baseURL,
    url: '/product/front/promotion/select_list',
    method: 'GET',
    params: params
  })
}

//加入购物车
export function addShoppingCart(params) {
  return request({
    baseURL: baseURL,
    url: '/order/cart/insert_cart',
    method: 'POST',
    data: params
  })
}

//商品收藏
export function addFavorites(params) {
  return request({
    baseURL: baseURL,
    url: '/favorites/product',
    method: 'POST',
    data: params
  })
}

//商品收藏统计
export function favoritesCount(params) {
  return request({
    baseURL: baseURL,
    url: '/favorites/product/count',
    method: 'GET',
    params: params
  })
}

//获取类目族谱
export function getCategoryFamily(params) {
  return request({
    baseURL: baseURL,
    url: '/category/family',
    method: 'GET',
    params: params
  })
}

//添加足迹
export function addViewHistory(params) {
  return request({
    baseURL: baseURL,
    url: '/member/view_history/add',
    method: 'POST',
    params: params
  })
}

//验证购物车
export function validateCart(params) {
  return request({
    baseURL: baseURL,
    url: '/order/cart/validate_cart',
    method: 'POST',
    data: params
  })
}
